<?php
/**
 *  💡 免责声明：本软件不得用于商业用途，仅做学习交流
 *  ⚠️ 权利声明：本软件由版权人提供产品技术支持
 *  📅 项目编号：NX2025-0135
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoldBeanAccountsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('gold_bean_accounts', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->decimal('total_beans', 18, 6)->default(0)->comment('总KC通证数');
            $table->decimal('locked_beans', 18, 6)->default(0)->comment('锁定KC通证(用于拼单)');
            $table->decimal('available_beans', 18, 6)->default(0)->comment('可用KC通证');
            $table->decimal('consumed_beans', 18, 6)->default(0)->comment('已消耗KC通证');
            $table->timestamps();
        });
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `gold_bean_accounts` comment 'KC通证账户'");
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('gold_bean_accounts');
    }
}
